﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SXICE.Core.Models;
using SXICE.IService;
using SXICE.IService.Models;
using SXICE.WebAPI.Utilities;
using AutoMapper;
using System.Collections.Generic;
using SXICE.Core.Domains;

namespace SXICE.WebAPI.Controllers
{
    /// <summary>
    /// 产品控制器
    /// </summary>
    [Route("")]
    [Authorize]
    public class ProductController : ControllerBase
    {
        private readonly IProductService productService;

        public ProductController(IProductService productService)
        {
            this.productService = productService;
        }

        /// <summary>
        /// 获取产品
        /// </summary>
        /// <returns>结果</returns>
        [HttpGet, AllowAnonymous]
        public ReturnResult<List<Product>> GetProducts()
        {
            return this.productService.Products;
        }
    }
}